package com.iqiyi.qigsaw.sample.ccode;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.dhy.annotations.Component;
import com.dhy.qigsaw.splash.data.TestCase;
import com.google.android.play.core.splitinstall.SplitInstallHelper;

import acom.dhy.qigsaw2test.App;

@Component
public class NativeSampleActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_native_sample);
        SplitInstallHelper.loadLibrary(this, "hello-jni");
        TextView hello_textview = findViewById(R.id.hello_textview);
        hello_textview.setText(stringFromJNI());
        App.getTestCases().put(TestCase.NATIVE, hello_textview.length() > 0);
        if (App.AUTO_TEST_MODE) hello_textview.postDelayed(this::finish, 1500);
    }

    public native String stringFromJNI();
}
